//
//  Common.swift
//  MLSina20160624
//
//  Created by manmanlang on 16/6/25.
//  Copyright © 2016年 manmanlang. All rights reserved.
//

import Foundation
import UIKit
import SnapKit

let ThemeColor = UIColor.orangeColor()
/// 切换控制器
let SwitchRootViewController = "SwitchRootViewController"

func RBG(red: CGFloat, green: CGFloat, blue: CGFloat) -> UIColor{
    return UIColor(red: red / 255, green: green / 255, blue: blue / 255, alpha: 1)
}
/// 随机颜色
func RandomColor() -> UIColor{
    let r = CGFloat(random()%256)
    let g = CGFloat(random()%256)
    let b = CGFloat(random()%256)
    return RBG(r, green: g, blue: b)
}

let UIScreen_Bounds = UIScreen.mainScreen().bounds
let UIScreen_Bounds_Height = UIScreen.mainScreen().bounds.height
let UIScreen_Bounds_Width = UIScreen.mainScreen().bounds.width
/// 微博相关信息参数
let ML_AppKey = "2008668396"
let ML_AppSecret = "d54555d332582c454154d496d18c0aeb"
let redirect_uri = "http://www.sina.com"

/// 输出日志
/// - parameter message:  日志消息
/// - parameter logError: 错误标记，默认是 false，如果是 true，发布时仍然会输出
/// - parameter file:     文件名
/// - parameter method:   方法名
/// - parameter line:     代码行数
func printLog<T>(message: T,
              logError: Bool = false,
              file: String = #file,
              method: String = #function,
              line: Int = #line)
{
    if logError {
        print("\((file as NSString).lastPathComponent)[\(line)], \(method): \(message)")
    } else {
        #if DEBUG
            print("\((file as NSString).lastPathComponent)[\(line)], \(method): \(message)")
        #endif
    }
}
